package com.Test;

import java.util.ArrayList;
import java.util.List;

public class Test05 {

    public static void main(String[] args) {
        int totalDays = 15;
        int totalMachines = 20;

        List<int[]> splits = splitProduct(totalDays, totalMachines);

        for (int[] split : splits) {
            System.out.println("Product A will be split into " + split[0] + " parts, each taking " + split[1] + " days and using " + split[2] + " machines.");
        }
    }

    public static List<int[]> splitProduct(int totalDays, int totalMachines) {
        List<int[]> splits = new ArrayList<>();

        for (int days = 1; days < totalDays; days++) {
            int machines = totalMachines - (totalDays - days);
            if (machines > 0 && machines <= totalMachines) {
                splits.add(new int[]{days, totalDays - days, machines, totalMachines - machines});
            }
        }

        return splits;
    }
}
